package com.pinyou.config.service;

import lombok.Data;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @Title: learnService
 * @Description:
 * @Auther:
 * @create 2020/3/19 21:00
 */
@Service
@Data
public class LearnService {
    public  void asyncFunc() {
        System.out.println("1");
        sleepTime();
        System.out.println("2");
    }
    @Async
    public void sleepTime() {
        try {
            Thread.sleep(5000);
            System.out.println("执行了async方法");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    //  @Scheduled(cron = "*/5 * * * * *" )
    public void scheduled(){
        System.out.println("scheduled执行了");
    }



}
